package cn.edu.stu.syllabus.oa.star;

import cn.edu.stu.syllabus.dao.OaInfoEntryDao;
import cn.edu.stu.syllabus.repository.oa.OaStarDataSource;
import cn.edu.stu.syllabus.repository.oa.local.OaStarLocalDataSource;
import cn.edu.stu.syllabus.di.qualifier.Local;
import cn.edu.stu.syllabus.di.scope.FragmentScoped;
import cn.edu.stu.syllabus.utils.GreenDaoUtils;
import dagger.Module;
import dagger.Provides;

/**
 * Created by daidaijie on 2017/3/21.
 */

@Module
public class OaStarPresenterModule {

    private final OaStarContract.View mView;

    public OaStarPresenterModule(OaStarContract.View view) {
        mView = view;
    }

    @Provides
    @FragmentScoped
    OaStarContract.View provideView() {
        return mView;
    }

    @FragmentScoped
    @Provides
    OaInfoEntryDao provideOaInfoEntryDao() {
        return GreenDaoUtils.getInstance().getSession().getOaInfoEntryDao();
    }

    @FragmentScoped
    @Provides
    @Local
    OaStarDataSource provideOaLocalDataSource(OaInfoEntryDao oaInfoEntryDao) {
        return new OaStarLocalDataSource(oaInfoEntryDao);
    }

}
